home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Python 1.4 / twit / twit.py < prev    next >
Encoding:
Python Source  |  1996-09-26  |  1.2 KB  |  54 lines  |  [TEXT/Pyth]

  1. """twit - The Window-Independent Tracer.
  2.  
  3. Interface:
  4. twit.main()                        Enter debugger in inactive interactive state
  5. twit.run(stmt, globals, locals)    Enter debugger and start running stmt
  6. twit.post_mortem(traceback)        Enter debugger in post-mortem mode on traceback
  7. twit.pm()                        Enter debugger in pm-mode on sys.last_traceback
  8.  
  9. main program: nothing but a bit of glue to put it all together.
  10.  
  11. Jack Jansen, CWI, August 1996."""
  12.  
  13. import os
  14. if os.name == 'mac':
  15. # Not supported in distributed 1.4b3:
  16. ##    import MacOS
  17. ##    MacOS.splash(515)    # Try to show the splash screen
  18.     import mactwit_app; twit_app = mactwit_app
  19. else:
  20.     try:
  21.         import _tkinter
  22.         have_tk = 1
  23.     except ImportError:
  24.         have_tk = 0
  25.     if have_tk:
  26.         import tktwit_app; twit_app = tktwit_app
  27.     else:
  28.         print 'Please implementent machine-dependent code and try again:-)'
  29.         sys.exit(1)
  30.     
  31. import sys
  32.     
  33. def main():
  34.     twit_app.Initialize()
  35. ##    if os.name == 'mac':
  36. ##        MacOS.splash()
  37.     twit_app.Twit('none', None)
  38.     
  39. def run(statement, globals=None, locals=None):
  40.     twit_app.Initialize()
  41.     twit_app.Twit('run', (statement, globals, locals))
  42.  
  43. def post_mortem(t):
  44.     Initialize()
  45.     twit_app.Twit('pm', t)
  46.     
  47. def pm():
  48.     post_mortem(sys.last_traceback)
  49.     
  50. if __name__ == '__main__':
  51.     main()
  52.     
  53.     
  54.